<template>
    <div>
        <el-select v-model="shelf" filterable clearable :size="size" @change="onChange">
            <el-option label="上架" value="1"></el-option>
            <el-option label="下架可见" value="2"></el-option>
            <el-option label="下架不可见" value="0"></el-option>
        </el-select>
    </div>
</template>
<script>
export default {
    name: "ShelfSelect",
    props: {
        value: {
            type: [String, Number],
            default: "",
        },
        size: {
            type: String,
            default: ''
        },
    },
    data() {
        return {
            shelf: ''
        };
    },
    watch: {
        value: {
            handler: function (n, o) {
                this.shelf = n;
            },
            immediate: true,
        },
    },
    created() {

    },
    methods: {

        // 监听组件变化
        onChange(e) {
            console.log(e);
            this.$emit("input", e.toString());
            this.$emit("change", e);
        },
    },
};
</script>
<style lang="scss" scoped>

</style>